package contador.z2;



import android.app.Activity;
import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.Spinner;

public class ContadorZ2Activity extends Activity {
   
	/** Called when the activity is first created. */
	Spinner seg,min;
    DialogoActivity dialogo; 
    
    private String[] minutos = {"0","1","2","3","5","10"};
    private String[] segundos = {"0","10", "30","59"};
    Intent it;
    
    //MediaPlayer player = new MediaPlayer();
    @Override    
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);    
        seg = (Spinner) findViewById(R.id.minuto);
        min = (Spinner) findViewById(R.id.segundo);
       
        it = new Intent(this,DialogoActivity.class);
       
        ArrayAdapter adaptadorMinutos = new ArrayAdapter(this, android.R.layout.simple_spinner_dropdown_item,minutos);
        adaptadorMinutos.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
        min.setAdapter(adaptadorMinutos);
        
        min.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {

			@Override
			public void onItemSelected(AdapterView parent, View v,	int posicao, long id) {
				 Log.d("[contadorz2]", "selecionado "+minutos[posicao]);
				 it.putExtra("min",  Integer.parseInt(minutos[posicao]));
			}

			@Override
			public void onNothingSelected(AdapterView<?> arg0) {
				// TODO Auto-generated method stub
				
			}
        	
		});
        
        ArrayAdapter adaptadorSegundos = new ArrayAdapter(this, android.R.layout.simple_spinner_dropdown_item,segundos);
        adaptadorSegundos.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
        seg.setAdapter(adaptadorSegundos);
        seg.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {

			@Override
			public void onItemSelected(AdapterView parent, View v,	int posicao, long id) {
				 Log.d("[contadorz2]", "selecionado "+segundos[posicao]);
				 it.putExtra("seg",  Integer.parseInt(segundos[posicao]));
				
			}

			@Override
			public void onNothingSelected(AdapterView<?> arg0) {
				// TODO Auto-generated method stub
				
			}
        	
		});
       
        
       
        
        Button start = (Button) findViewById(R.id.iniciar);
        start.setOnClickListener(new View.OnClickListener() {      
            @Override
            public void onClick(View v) {
            	finish();
        		startActivity(it);
            }
        });
    }
   
    
}
 